package com.buba.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import entity.device.Deviceprocure;
import com.buba.mapper.DeviceprocureMapper;
import com.buba.service.DeviceprocureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import entity.device.EquipmentArchives;
import entity.device.dto.DeviceprocureDto;
import entity.device.dto.DeviceprocureQueryWrapper;
import entity.device.dto.EquipmentArchivesQueryWrapper;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import utils.pageutil.MyPageHelper;
import utils.pageutil.PageRequest;
import utils.pageutil.PageResult;

import java.util.List;

/**
 * <p>
 * 设备采购信息表 服务实现类
 * </p>
 *
 * @author beisheng
 * @since 2023-05-18
 */
@Service
public class DeviceprocureServiceImpl extends ServiceImpl<DeviceprocureMapper, Deviceprocure> implements DeviceprocureService {
    @Autowired
    private DeviceprocureMapper deviceprocureMapper;


    /**
     * @return common.R
     * @Author atlong
     * @Description 模糊分页全查设备采购信息
     * @Date 2023/6/4 19:45
     * @Param [deviceprocureDto]
     **/
    @Override
    public PageResult selDeviceprocure(DeviceprocureDto deviceprocureDto) {
        DeviceprocureQueryWrapper deviceprocureQueryWrapper = new DeviceprocureQueryWrapper();
        QueryWrapper<Deviceprocure> conditional = deviceprocureQueryWrapper.conditional(deviceprocureDto);
        PageRequest pageRequest = new PageRequest(deviceprocureDto.getPage(), deviceprocureDto.getPageSize());
        MyPageHelper.startPage(pageRequest);
        List<Deviceprocure> list = deviceprocureMapper.selectList(conditional);
        PageResult pageResult = MyPageHelper.getPageResult(list);
        return pageResult;
    }
}
